package com.acwing.lc.part1;

/**
 * @author rkc
 * @date 2022/9/18 9:54
 */
public class LC69x的平方根 {

    public int mySqrt(int x) {
        int l = 0, r = x;
        while (l < r) {
            int mid = (int) (l + r + 1L >> 1);
            if (mid <= x / mid) l = mid;
            else r = mid - 1;
        }
        return l;
    }
}
